*** Settings ***
Test Template     Login with invalid credentials should fail
Library           Selenium2Library

*** Variables ***
${SERVER URL}     http://localhost/smeoa/index.php?m=login&a=index    # this is the comment for server URL
${VALID USERNAME}    admin
${VALID PASSWORD}    admin

*** Test Cases ***    USERNAME             PASSWORD
Invalid Username      invalid              ${VALID PASSWORD}

Invalid Password      ${VALID USERNAME}    invalid

Invalid Both          invalid              invalid

Empty Username        ${EMPTY}             ${VALID PASSWORD}

Empty Password        ${VALID USERNAME}    ${EMPTY}

Empty Both            ${EMPTY}             ${EMPTY}

*** Keywords ***
Login with invalid credentials should fail
    [Arguments]    ${username}    ${password}
    open browser    ${SERVER URL}    chrome
    Input text    id = emp_no    ${username}
    Input text    id = password    ${password}
    click button    xpath = //input[@value='登录']
    sleep    2
    wait until page contains element    xpath = //input[@value='登录']    20    error
    close browser
